const getParityBit = (idCardNo: any) => {};

const parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];
export function checkIdNumberValid(idCardNo) {
  if (idCardNo.length != 18) {
    return false;
  }
  let powers = ['7', '9', '10', '5', '8', '4', '2', '1', '6', '3', '7', '9', '10', '5', '8', '4', '2'];
  var id17 = idCardNo.substring(0, 17);
  var power = 0;
  for (var i = 0; i < 17; i++) {
    power += parseInt(id17.charAt(i), 10) * parseInt(powers[i]);
  }
  let num = idCardNo.substring(17, 18);

  var mod = power % 11;
  if (parityBit[mod] == num) {
    return true;
  } else {
    return false;
  }
  // return parityBit[mod];
}
